clip2gif is a utility program for converting PICTs to GIF or JPEG files. The PICT is taken from the clipboard or a file, and the output is written to a file. Options include output size, pixel depth, interlacing, transparency, gray shades only and JPEG compression quality.
clip2gif has been written to allow the dynamic creation of pictures to be served on the Web; it's one of the few graphic utilities that (a) are scriptable and (b) write gifs.
Usage
a) Manual conversion of a PICT file
Launch clip2gif, set the output file format and other options, and use “Convert Pict File...”
b) Batch conversion of PICT files
Be sure that the output file format and other options are correct (either by launching clip2gif and setting them, or by having “Save[d] Options” in a previous session), and drag all the PICT files onto the clip2gif icon.
c) Manual conversion of the clipboard
Copy a PICT graphic in any application, launch clip2gif, set the output file format and other options, and use “Save Clipboard As...”. Icons can easily be converted too.
d) Scripting
clip2gif implements the following AppleEvents:
run:
run
convert:
convert anything -- the file(s) to convert, or {width,height} (default: clipboard)
saving as type class
[in file specification]
[transparency boolean]
[interlacing boolean]
[gray shades boolean]
[depth small integer] -- bits per pixels
[scale small integer] -- scale factor in %
[quality very low/low/normal/high/very high]
[drawing list]
quit:
quit
Note that “convert” corresponds to the 'odoc' AppleEvent. Note also that due to a limitation of the Mac toolbox, clip2gif must be active in order to use the clipboard (as well as any application you copy a PICT from); use “activate” in a script.
clip2gif is recordable (i.e. you can record the conversions with all their options in an AppleScript if you push the record button of the ScriptEditor).
Typical use
tell application "clip2gif"
convert file "test.pict" saving as GIF scale 50 depth 4 with interlacing without transparency
--creates a file named test.gif
end tell
Drawings
It's possible to script clip2gif to draw simple graphical elements, such as text, lines, frames and filled rectangles. For this, use the drawing argument. Scale has no effect. You can start either with an existing picture (specify a PICT file the usual way), or with a blank rectangle (specify its size as a list of two numbers). The argument of drawing is a list of records containing:
frame:{left,top,right,bottom} -- outline of rectangle
line:{x1,y1,x2,y2} -- straight line
RGB color:{r,g,b} -- red, green and blue in %
position:{x,y} -- position of the text
font:"font name" -- font name
size:fontSize -- characters size (in points)
Examples
--converts a PICT file to GIF and adds a title
convert file "test.pict" saving as GIF with interlacing drawing
{{drawn text:"This is a test", position:{50,20}, RGB color:{100,0,0},font:"Times",size:24}}
--creates a GIF file from scratch with a line, a frame and a filled rectangle
convert {240,160} saving as GIF in file "test.gif"
drawing {{line:{10,10,100,10},thickness:2},
{frame:{10,20,100,80}},
{rectangle:{15,25,105,85},RGB color:{100,100,0}}}
Requirements
clip2gif needs System 7 or above and 32-bit Color Quickdraw. QuickTime is needed for JPEG conversion. AppleScript is obviously needed to (Apple-)script clip2gif. The entire scaled image must fit in RAM; set the application memory partition appropriately.
Copyright
clip2gif Copyright 1995 by Yves Piguet.
clip2gif is freeware; this means that you can freely use it, copy it and give it to your friends as long as:
-clip2gif and this readme file are kept together;
-clip2gif is not modified (especially the copyright notice) or reverse-engineered;
-you don't charge for it.
clip2gif 0.4 for HTML+ is strictly the same as clip2gif 0.4; only the version shown in the Get Info window is different. clip2gif 0.4 can be found on the info-mac server and its mirrors in grf/util as "clip-to-gif-04.sit.hqx".
clip2gif cannot be included in another package without my prior written permission.
Source code is not available.
Please send me a note (postcards or email or banknotes) if you use it!
Changes
0.4
• Graphic elements
• Creation from an empty rectangle
• Gray shades GIF output
• Edit menu (useful only with the "Save as" dialog)
• More system environment tests
• Balloon help
0.3.0.1
• AppleShare volume writing corrected
0.3
• “convert "..." saving as...” AE to allow different output file formats
• JPEG output (if QuickTime is present)
• PICT output (useful only for the clipboard)
• recordable
• preferences file
• icons
• displays the about box when an oapp Apple Event is received
• the depth parameter code is now 'pdpt', as specified in the AppleEvent Registry
0.2
• fat binary
• possibility to scale the output between 1 & 1000 % (open the "Get Info" of clip2gif and specify more memory if necessary; 1000% of a 640x480 screen means 30 Mb!)
• watch cursor during conversion
• "Save Clipboard As Gif..." dimmed if the clipboard doesn't contain a pict
Warranty
There is absolutely NO warranty. clip2gif seems to work as expected, at least on my computer, but I'm not liable for any loss of data, damages, etc. or any consequential effect. It has produced files a few programs seem to be able to decode, but it is in no way "certified" to encode fully compliant GIF files.
Acknowledgement
The Graphics Interchange Format(c) is the Copyright property of CompuServe Incorporated. GIF(sm) is a Service Mark property of CompuServe Incorporated.
Disclaimer
The above statement doesn't mean anything more than what is specified in the GRAPHICS INTERCHANGE FORMAT v.89a specifications.